/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.WareCategoryPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.IWareCategoryMapper;

@Service
public class WareCategoryService {
	@Autowired
	private IWareCategoryMapper wareCategoryMapper;
	
	/**
	 * 根据ID获取WareCategoryPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return WareCategoryPo
	 */
	public WareCategoryPo getWareCategory(int id) {
		return wareCategoryMapper.findWareCategoryById(id);
	}
	
	/**
	 * 根据条件获取WareCategoryPo对象，并返回查询的数据总数
	 * 
	 * @param wareCategory
	 * @Author 迷蝶
	 * @return ResultPageTo<WareCategoryPo>
	 */
	public ResultPageTo<WareCategoryPo> getWareCategorysByPage(WareCategoryPo wareCategory) {
		return new ResultPageTo<WareCategoryPo>(wareCategory.getStart(), wareCategory.getSize(), 
				wareCategoryMapper.findWareCategoryCount(wareCategory), wareCategoryMapper.findWareCategorys(wareCategory));
	}

	
	/**
	 * 根据条件获取WareCategoryPo对象，不分页
	 * 
	 * @param wareCategory
	 * @Author 迷蝶
	 * @return ResultPageTo<WareCategoryPo>
	 */
	public List<WareCategoryPo> getWareCategorys(WareCategoryPo wareCategory) {
		return wareCategoryMapper.findWareCategorys(wareCategory);
	}
	
	/**
	 * 根据ID删除WareCategoryPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delWareCategory(int id) {
		return wareCategoryMapper.delWareCategoryById(id);
	}
	
	/**
	 * 增加WareCategoryPo对象
	 * 
	 * @param wareCategory
	 * @Author 迷蝶
	 */
	public Integer addWareCategory(WareCategoryPo wareCategory) {
		return wareCategoryMapper.addWareCategory(wareCategory);
	}
	
	/**
	 * 根据条件更新WareCategoryPo对象
	 * 
	 * @param wareCategory
	 * @Author 迷蝶
	 */
	public Integer updateWareCategory(WareCategoryPo wareCategory) {
		return wareCategoryMapper.updateWareCategory(wareCategory);
	}
	
}
